
package peste;

import model.PersonModel;

import model.ObjectModel;

import model.HouseModel;

import model.RoomModel;

import java.io.*;
public class Om {


 public static FileOutputStream Output;
 public static PrintStream file;

public static void personalizare () {
for(int i=0;i<PersonModel.list.size();i++){
			
			PersonModel current=PersonModel.list.get(i);
			//		ACTIUNI
//astea poate sa le faca oricine

current.setPoate(true,1);//se trezeste
current.setTimp(1, 1);
current.setPoate(true,4);//se culca
current.setTimp(4, 1);
current.setPoate(true,5);//pleaca
current.setTimp(5, 360);
current.setPoate(true,6);//vine acasa
current.setTimp(6, 1);
current.setPoate(true,7);//bea
current.setTimp(7, 1);
current.setPoate(true,8);//se odihneste
current.setTimp(8, 46);
current.setPoate(true,9);//face baie
current.setTimp(9, 55);
current.setPoate(true,10);//face dus
current.setTimp(10, 20);
current.setPoate(true,11);//mananca
current.setTimp(11, 20);
//current.setPoate(true,12);//intra

current.setPoate(true,13);//foloseste

if (current.getAge()>5) {
	current.setPoate (true, 2);//deschide geamul
	current.setTimp(2, 1);
	current.setPoate (true, 3);//inchide geamul
	current.setTimp(3, 1);
 }
 else {
 	current.setPoate (false, 2);//deschide geamul
	current.setPoate (false, 3);//inchide geamul
}

if (current.getAge()>3) {
	current.setPoate (true, 14);//porneste (becul)
//	current.setTimp(14, 1);
	current.setPoate (true, 15);//opreste (becul)
//	current.setTimp(15, 1);
 }
 else {
 	current.setPoate (false, 14);
	current.setPoate (false, 15);
}


if (current.getAge()>9) {
	current.setPoate (true, 0);//stinge tot
	current.setTimp(0, 1);
	current.setPoate (true, 16);//da mai tare sau mai incet
	//current.setTimp(16, 1);
 }
 else {
 	current.setPoate (false, 0);
 	current.setPoate (false, 16);
	
}
///				OBIECTE

for(int p=0;p<HouseModel.roomList.size();p++){
			RoomModel currentModel=HouseModel.roomList.get(p);
			for(int j=0;j<currentModel.getObjectList().size();j++) {
				ObjectModel current1=HouseModel.roomList.get(p).getObjectList().get(j);
	
	if(current1.getType().equalsIgnoreCase("Sink") ) 
	if(current.getAge() > 0) {
		current.setBroasca(true,1);
	current.setTimp(14, 5);}
	//else current.setBroasca(false,1);
	
	if(current1.getType().equalsIgnoreCase("Toilet") ) 
	if(current.getAge() > 0){
		current.setBroasca(true,0);
	current.setTimp(13, 5);}
	//else current.setBroasca(false,0);
	
	if(	current1.getType().equalsIgnoreCase("Hair_dryer"))
	if(current.getAge() > 2){
		current.setBroasca(true,2);
		current.setTimp(15, 10);}
//	else current.setBroasca(false,2);
		
	if(current1.getType().equalsIgnoreCase("Gas_cooker"))
	if(current.getAge() > 9){
		current.setBroasca(true,3);
		current.setTimp(16, 30);}
		
	//else current.setBroasca(false,3);
	
	if(current1.getType().equalsIgnoreCase("Refrigerator"))
	if(current.getAge() > 0) {
		current.setBroasca(true,4);
		current.setTimp(17, 2);}
	//else current.setBroasca(false,4);
	
	if(current1.getType().equalsIgnoreCase("Vacuum_cleaner"))
	if(current.getAge() > 5) {
		current.setBroasca(true,5);
		current.setTimp(18, 30); }
	//else current.setBroasca(false,5);
	
	if(current1.getType().equalsIgnoreCase("TV"))
	if(current.getAge() > 2)
		current.setBroasca(true,6);
	//else current.setBroasca(false,6);
	
	if(current1.getType().equalsIgnoreCase("Air_conditioning"))
	if(current.getAge() > 9)
		current.setBroasca(true,7);
	//else current.setBroasca(false,7);
	
	if(current1.getType().equalsIgnoreCase("Computer"))
	if(current.getAge() > 4)
		current.setBroasca(true,8);
//	else current.setBroasca(false,8);
	
	if(current1.getType().equalsIgnoreCase("Radiator"))
	if(current.getAge() > 10)
		current.setBroasca(true,9);
//	else current.setBroasca(false,9);
	
	if(current1.getType().equalsIgnoreCase("Light"))
	if(current.getAge() > 3)
		current.setBroasca(true,10);
//	else current.setBroasca(false,10);

	if(current1.getType().equalsIgnoreCase("Heating"))
	if(current.getAge() > 6)
		current.setBroasca(true,11);
//	else current.setBroasca(false,11);

if(current1.getType().equalsIgnoreCase("Stove"))
if(current.getAge() > 7)
		current.setBroasca(true,12);
//	else current.setBroasca(false,12);

if(current1.getType().equalsIgnoreCase("Electric_plate"))
if(current.getAge() > 6)
		current.setBroasca(true,13);
//	else current.setBroasca(false,13);

if(current1.getType().equalsIgnoreCase("Coffe_filter"))
if(current.getAge() > 12)
		current.setBroasca(true,14);
//	else current.setBroasca(false,14);

if(current1.getType().equalsIgnoreCase("Toaster"))
if(current.getAge() > 4)
		current.setBroasca(true,15);
//	else current.setBroasca(false,15);

if(current1.getType().equalsIgnoreCase("Washing_machine"))
if(current.getAge() > 13)
		current.setBroasca(true,16);
//	else current.setBroasca(false,16);
				}
			}
		}
	}
	
public static void fish () {
	try
          { Output = new FileOutputStream("blah.txt");
			file = new PrintStream(Output);
			}
    catch(Exception e)
          {
               System.out.println("Could not load file!");
          }	
          
          //se creaza oameniii
          
     for(int i=0;i<PersonModel.list.size();i++){
			
			PersonModel current=PersonModel.list.get(i);
			file.println("create "+current.getName()); }
			
			//intrari
			
			 for(int i=0;i<PersonModel.list.size();i++){
			 	PersonModel current=PersonModel.list.get(i);
			  	for(int k=0;k<HouseModel.roomList.size();k++){
			RoomModel currentModel=HouseModel.roomList.get(k);
				file.println(current.getName()+" enters the "+currentModel.getType()+" at x:t for 1");
				file.println(current.getName()+" exits the "+currentModel.getType()+" at x:t for 1" );
			  	}
			
			for(int j=0;j<HouseModel.roomList.size();j++){
				RoomModel currentModel=HouseModel.roomList.get(j);
				if(currentModel.getType().equalsIgnoreCase("Bedroom")){
					file.println(current.getName()+" wakes up in "+currentModel.getType()+" at x:t for 1");
					file.println(current.getName()+" goes to bed in "+currentModel.getType()+" at x:t for 1");
				}
			}
		}
					
			
			
			//activitati
			 int aux=13; // variabila folosita din cauza lu lili
    for(int i=0;i<PersonModel.list.size();i++){
   
			
			PersonModel current=PersonModel.list.get(i);
			for(int j=0; j<8; j++) if(j!=1 && j!=4)
				if(current.getPoate(j))
					file.println(current.getName()+" "+
								current.actiuni[j]+" "+
								"at x:t for "+current.getTimp(j)); // endfor
		for(int j=8; j<13; j++) if(j!=1 && j!=4)
				if(current.getPoate(j))
					file.println(current.getName()+" "+
								current.actiuni[j]+" "+
								"From x:t to y:v for "+current.getTimp(j)); // endfor
			int j=13; //uses
			aux=13;
			if(current.getPoate(j))
			for(int p=0; p<6; p++) { 
				if(current. getBroasca(p)) 
					file.println(current.getName()+ " " +
								current.actiuni[j]+" " +
							current.obiecte[p]+" "+
							"From x:t to y:v for "+current.getTimp(aux)); 
			
				aux++;
			}
			// acuma aux ii 19. 
			for(j=14; j<16; j++) // turns on/off 
			if(current.getPoate(j))
			for(int p=6; p<17; p++)
				if(current.getBroasca(p))
					file.println(current.getName()+ " " +
							current.actiuni[j]+ " " +
							current.obiecte[p]+ " " +
							"at x:t for 1"); 
			j=16;
			if(current.getPoate(j)) {
			int p=4;
			if(current.getBroasca(p))
				for(int a=0; a<3; a++)
					file.println(current.getName()+ " " +
							current.actiuni[j]+ " " +
							current.obiecte[p]+ " " +
							current.nivele[a]+" "+
							"at x:t for 1");
			p=7;
			if(current.getBroasca(p))
				for(int a=0; a<3; a++)
					file.println(current.getName()+ " " +
							current.actiuni[j]+ " " +
							current.obiecte[p]+ " " +
							current.nivele[a]+" "+
							"at x:t for 1");
			 p=9;
			if(current.getBroasca(p))
				for(int a=0; a<3; a++)
					file.println(current.getName()+ " " +
							current.actiuni[j]+ " " +
							current.obiecte[p]+ " " +
							current.nivele[a]+" "+
							"at x:t for 1");
			 p=11;
			if(current.getBroasca(p))
				for(int a=0; a<3; a++)
					file.println(current.getName()+ " " +
							current.actiuni[j]+ " " +
							current.obiecte[p]+ " " +
							current.nivele[a]+" "+
							"at x:t for 1");
			 p=12;
			if(current.getBroasca(p))
				for(int a=0; a<3; a++)
					file.println(current.getName()+ " " +
							current.actiuni[j]+ " " +
							current.obiecte[p]+ " " +
							current.nivele[a]+" "+
							"at x:t for 1" +
							"");
							}
				
}
}

}

